package network;

import java.io.IOException;
import java.util.HashMap;

public class TcpDictionaryServer extends TcpThreadPool{
    private HashMap<String,String> map = new HashMap<>();
    public TcpDictionaryServer(int port) throws IOException {
        super(port);
        map.put("cat","汤姆猫");
        map.put("dog","哈士奇");
        map.put("pig","佩奇");
    }

    @Override
    public String process(String request) {
        return map.getOrDefault(request,"没有对应的词义");
    }

    public static void main(String[] args) throws IOException {
        TcpDictionaryServer server = new TcpDictionaryServer(9090);
        server.start();
    }
}
